package ntd.util.frame.haikang.tool;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import ntd.util.config.common.exception.ComException;
import ntd.util.frame.haikang.remote.HaiKangConfig;
import ntd.util.frame.haikang.remote.RemoteHaiKang;
import ntd.util.modular.function.entity.ChannelBusiness;
import ntd.util.modular.function.util.UtilChannelBusiness;

public class ToolHaiKangVideo {

    public static RemoteHaiKang initHaiKang(String channelBusinessId) {
        ChannelBusiness channelBusiness = UtilChannelBusiness.getById(channelBusinessId);
        JSONObject settingJson = JSONUtil.parseObj(channelBusiness.getSettingJson());
        HaiKangConfig haiKangConfig = new HaiKangConfig();
        haiKangConfig.setHost(settingJson.getStr("host"));
        haiKangConfig.setAppKey(channelBusiness.getAppKey());
        haiKangConfig.setAppSecret(channelBusiness.getAppSecret());
        haiKangConfig.setHttpsTag(settingJson.getBool("httpsTag", false));
        return RemoteHaiKang.me(haiKangConfig);
    }
}
